package com.hxd.otc.module.my.bean;

import android.text.TextUtils;

import com.hxd.otc.common.enums.BankType;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * Created by lzy on 2018/6/7 0007.
 * description ${银行卡}
 */
public class BankCardBean implements Serializable {
    private String bankName;//银行卡
    private String branchBankName;//分行
    private String cardNo;//银行卡号
    private String country;//国家
    private String createBy;//
    private String createDate;//创建时间
    private String id;//银行卡id
    private String mobile;//手机号
    private String payNo;//
    private String qrcodeId;
    private String realName;
    private int status;//0弃用，1使用中
    private String supportCurrencyCode;//支持法币币种
    private int type;//1微信2支付宝3银行卡
    private String updateBy;//
    private String updateDate;//更新时间
    private String userId;//用户id

    //本地字段
    private boolean isSelected;

    private ArrayList<AdRelatedAmountBean> items;

    public String getBankName() {
        BankType bankType = BankType.getBankTypeByValue(type);
        if (BankType.WEXIN.equals(bankType) || BankType.ALIPAY.equals(bankType)) {
            return bankType.getBankName();
        } else {
            return bankName;
        }
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getBranchBankName() {
        return branchBankName;
    }

    public void setBranchBankName(String branchBankName) {
        this.branchBankName = branchBankName;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getPayNo() {
        return payNo;
    }

    public void setPayNo(String payNo) {
        this.payNo = payNo;
    }

    public String getQrcodeId() {
        return qrcodeId;
    }

    public void setQrcodeId(String qrcodeId) {
        this.qrcodeId = qrcodeId;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getSupportCurrencyCode() {
        return supportCurrencyCode;
    }

    public void setSupportCurrencyCode(String supportCurrencyCode) {
        this.supportCurrencyCode = supportCurrencyCode;
    }

    public String[] getSupporCurrencyArray() {
        if (TextUtils.isEmpty(supportCurrencyCode)) return new String[]{};
        if (!supportCurrencyCode.contains(",")) return new String[]{supportCurrencyCode};
        return supportCurrencyCode.split(",");
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public String getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(String updateDate) {
        this.updateDate = updateDate;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    public BankType getBankType() {
        return BankType.getBankTypeByValue(type);
    }

    public ArrayList<AdRelatedAmountBean> getItems() {
        return items;
    }

    public void setItems(ArrayList<AdRelatedAmountBean> items) {
        this.items = items;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BankCardBean that = (BankCardBean) o;

        return id != null ? id.equals(that.id) : that.id == null;
    }

    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }

    @Override
    public String toString() {
        return "BankCardBean{" +
                "bankName='" + bankName + '\'' +
                ", branchBankName='" + branchBankName + '\'' +
                ", cardNo='" + cardNo + '\'' +
                ", country='" + country + '\'' +
                ", createBy='" + createBy + '\'' +
                ", createDate=" + createDate +
                ", id='" + id + '\'' +
                ", mobile='" + mobile + '\'' +
                ", payNo='" + payNo + '\'' +
                ", qrcodeId='" + qrcodeId + '\'' +
                ", realName='" + realName + '\'' +
                ", status=" + status +
                ", supportCurrencyCode='" + supportCurrencyCode + '\'' +
                ", type=" + type +
                ", updateBy='" + updateBy + '\'' +
                ", updateDate=" + updateDate +
                ", userId='" + userId + '\'' +
                ", isSelected=" + isSelected +
                ", items=" + items +
                '}';
    }
}
